/**
 * 判断是否为空
 * [] {} false 0 "" null undefined
 */
export function isEmpty(val: any): boolean {
    if (val && typeof val === 'object') {
        if (val.length && val.length > 0) {
            return false;
        }

        for (const key in val) {
            if (Reflect.has(val, key)) {
                return false;
            }
        }
        return true;
    }
    return !val;
}

/**
 * 判断不是为空
 * [] {} false 0 "" null undefined
 */
export function isNotEmpty(val: any): boolean {
    return !isEmpty(val);
}
/**
 * 判断是否为函数
 * @param val 
 * @returns 
 */
export function isFunction(val: any): boolean {
    return typeof val === 'function';
}